package com.atguigu.controller;


import com.atguigu.service.FileUploadServer;
import com.atguigu.vo.common.Result;
import com.atguigu.vo.common.ResultCodeEnum;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@Tag(name = "文件上传")
@RestController
@RequestMapping("/system/upload")
public class FileUploadController {

    @Autowired
    private FileUploadServer fileUploadServer;

    @PostMapping("/")
    public Result upload(MultipartFile file) {
        String upload = fileUploadServer.upload(file);
        return Result.build(upload, ResultCodeEnum.SUCCESS);
    }
}
